-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding ReasonForError usage: #384
Conversation
- Required update k8s.io/apimachinery to 1.9 - Added processErrorReasons mapping private function Signed-off-by: Andrew Cornies <acornies@gmail.com>
Is CI blocked? Do we know why? |
I don't see any link for CI details, which is really weird |
Why is this PR draft? Is that why? Is this WIP or ready for review @acornies ? |
case k8serrors.ReasonForError(err) == metav1.StatusReasonBadRequest: | ||
log.Printf("Secret %s error reason: %s, %v\n", context, metav1.StatusReasonBadRequest, err) | ||
return http.StatusBadRequest | ||
case k8serrors.ReasonForError(err) == metav1.StatusReasonForbidden: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess my concern with this approach is that we don't give the reason for the error back to the caller.
We should also be able to test this new method that has been broken out with unit tests when we have a final design on how it is going to work.
I am not super keen on logging in the function. I'd rather see you return the Status Code plus a message that we then chose to log in the calling function - thereby applying Single Responsibility Principle (SRP)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
The last build on travis looks like this https://travis-ci.org/openfaas/faas-cli/builds/504025019 for 54ee31dd7e3d538783ba9466f81dc5ab98a793bd which does not match the current commit |
Yeah, the draft PRs mess with CI usually. I chose it so that we could deliberate on the change first (pre-unit tests as well). I'll update with recent feedback. |
- move logging back to caller - return both http status code and k8s reason - add tests for default and conflict reasons Signed-off-by: Andrew Cornies <acornies@gmail.com>
I've updated the PR. Can someone flip this PR status to non-draft mode? I don't have permissions. |
I would have thought since it's your PR you can set it out of draft. What do the GH docs say? This is a new feature and I don't entirely see the point of it |
Normally you can: https://help.github.com/en/articles/changing-the-stage-of-a-pull-request. Is it because I'm not a member of any teams? |
Thank you for your contribution. I've just checked and your commit doesn't appear to be signed-off. That's something we need before your Pull Request can be merged. Please see our contributing guide. |
To address #362 by mapping more appropriate http error responses for secrets API.
Description
Motivation and Context
How Has This Been Tested?
TODO
Types of changes
Checklist:
git commit -s